#include<stdio.h>
#define ARRAYSIZE	 10

int main(int argc, char* argv[]){
	int a[ARRAYSIZE]={1,2,3,4,5};
	int i;
	FILE *bf, *tf;
	if (argv != 3){
		printf("Usage: %s <binary file> <text file>\n", argv[0]);
		return 1;
	}

	for (i = 0; i < ARRAYSIZE; i++)
		printf("%d",a[i]);
	if ((bf = fopen(argv[1], "wb")) == NULL){
		printf("Problem while opening the file %s", argv[1]);
		return 2;
	}
	if ((tf = fopen(argv[1], "wt")) == NULL){
		printf("Problem while opening the file %s", argv[2]);
		return 2;
	}
	fwrite (a,sizeof(int),ARRAYSIZE, bf);
	fclose(fb);
	fclose(ft);
//para borrar lo q hay en el array
	for(i = 0; i < T; i++){ 
		v[i] = 0;
		printf("%d",v[i]);
	}
	putchar('\n');
//para leer
	fb = fopen("ficherobinario","rb");
	ft = fopen("fichero texto", "rt");

	fread( v,sizeof(int),T,fb);
	fscanf( "%d",&ft);
	fclose(fb);
 	fclose(ft);
	
	for(i = 0; i < T; i++)
		printf("%d",v[i]);
	putchar('\n');
}//find e main
